﻿namespace BasicParts
{
    public struct Vector2
    {
        public float X, Y;

        //public Vector2() { X = Y = 0; }
        public Vector2(float x, float y) { this.X = x; this.Y = y; }
        public Vector2(float xy) { this.X = this.Y = xy; }

        public static Vector2 Zero { get { return new Vector2(); } }
        public static Vector2 One { get { return new Vector2(1); } }

        public override string ToString()
        {
            return X.ToString() + ", " + Y.ToString();
        }

        public static Vector2 operator -(Vector2 v)
        {
            return new Vector2(-v.X, -v.Y);
        }

        public static Vector2 operator *(int i, Vector2 v)
        {
            return new Vector2(v.X * i, v.Y * i);
        }
        public static Vector2 operator *(Vector2 v, int i)
        {
            return new Vector2(v.X * i, v.Y * i);
        }

        public static Vector2 operator *(float i, Vector2 v)
        {
            return new Vector2(v.X * i, v.Y * i);
        }
        public static Vector2 operator *(Vector2 v, float i)
        {
            return new Vector2(v.X * i, v.Y * i);
        }

        public static Vector2 operator +(Vector2 v1, Vector2 v2)
        {
            return new Vector2(v1.X + v2.X, v1.Y + v2.Y);
        }

        public static Vector2 operator -(Vector2 v1, Vector2 v2)
        {
            return new Vector2(v1.X - v2.X, v1.Y - v2.Y);
        }
        public static Vector2 operator *(Vector2 v1, Vector2 v2)
        {
            return new Vector2(v1.X * v2.X, v1.Y * v2.Y);
        }
        public static Vector2 operator /(Vector2 v1, Vector2 v2)
        {
            return new Vector2(v1.X / v2.X, v1.Y / v2.Y);
        }

        public static Vector2 operator +(Vector2 v1, Point v2)
        {
            return new Vector2(v1.X + v2.X, v1.Y + v2.Y);
        }
        public static Vector2 operator -(Vector2 v1, Point v2)
        {
            return new Vector2(v1.X - v2.X, v1.Y - v2.Y);
        }
        public static Vector2 operator *(Vector2 v1, Point v2)
        {
            return new Vector2(v1.X * v2.X, v1.Y * v2.Y);
        }
        public static Vector2 operator /(Vector2 v1, Point v2)
        {
            return new Vector2(v1.X / v2.X, v1.Y / v2.Y);
        }
    }
}